;====================================================================
; Project:     The Suspect 
; Version:     0.1
; Author:      Marco Sessa
; Email:       marcosessa@gmail.com
; Copyright:   Zarkosoft
; Description: 
;              13 July 2011     
;                   
;====================================================================

Include "constants.bb"


;go into graphics mode
Graphics screen_width,screen_height
Include "players.bb"
Include "gameInterface.bb"
Include "guess.bb"
Include "utils.bb"


;enable double buffering
SetBuffer BackBuffer()

;load characters data
setupCharacters()
;player=LoadImage("graphics\player.bmp")

SeedRnd MilliSecs()

;initialize player position
Local player_x=0
Local player_y=0


;-------------------------------------------
; ADD MENU
;-------------------------------------------
;


;-------------------------------------------
;selectRandomCharacter
;-------------------------------------------
newGame()

;While (suspectIdPlayer2 = suspectIdPlayer1)
;  suspectIdPlayer2 = selectRandomCharacter()
;Wend


;loop until ESC hit...
While Not KeyDown(1)
  
  ;is left key being held?
	If KeyHit(203)
    ;suspectIdPlayer2 = selectRandomCharacter()
    If showSuspectInfo = True
      showSuspectInfo = False
    Else
      showSuspectInfo = True
    EndIf
    
		;move player to the left
		;player_x=player_x-4
		
		;stop the player going 'off screen'
		;If player_x<0 Then player_x=0
		
	EndIf
	
	;is right key being held?
	If KeyHit(205)
    SaveScreenshot()
    suspectIdPlayer1 = selectRandomCharacter()
    For pl.player = Each player
      Delete pl
    Next
    
    setupCharacters()
    
		;move player to the right
		;player_x=player_x+4
		
		;stop the player going 'off screen'
		;If player_x>screen_width Then player_x=screen_width
    
	EndIf
	
  If KeyHit(2) ; user press "1" and I check if is male
    checkAttributes(3,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(3) ; user press "2" and I check if has glasses
    checkAttributes(11,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(4) ; user press "3" and I check if is white
    checkAttributes(4,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(5) ; user press "4" and I check if has barba baffi
    checkAttributes(8,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(6) ; user press "5" and I check if has cappello
    checkAttributes(12,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(7) ; user press "6" and I check if has basette
    checkAttributes(9,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(8) ; user press "7" and I check if has blue eyes
    checkAttributes(7,4,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(9) ; user press "8" and I check if has green eyes
    checkAttributes(7,7,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(10) ; user press "9" and I check if has long hair
    checkAttributes(6,1,suspectIdPlayer1)  
  EndIf
  
  If KeyHit(11) ; user press "0" and I check if has short hair
    checkAttributes(13,1,suspectIdPlayer1)  
  EndIf
  
	If KeyHit(18)
    ;E = ENGLISH
    Language = ENGLISH
  EndIf
  
  If KeyHit(23)
    ;I = ITALIAN
    Language = ITALIAN
  EndIf
	
;clear the screen
	Cls
	
	;draw the player
  drawPlayers(player_x,player_y)
  
  ;draw game inferface
  drawInterface()
  
  
  Text 400,0, maxChars + " - " + removedChars
  If (maxChars - removedChars) = 1
    showSuspectInfo = True
    SuspectGuessed()
    
    If (isGameFinished = True And KeyHit(28))
      For pl.player = Each player
        Delete pl
      Next
      
      setupCharacters()
      
      isGameFinished = False
    End If
    
  EndIf
  
  
	;swap front and back buffers
	Flip
	
Wend


;~IDEal Editor Parameters:
;~C#Blitz3D